package cn.maihe.elg.operation.repository.entity;

import cn.maihe.framework.starter.base.sql.BaseEntity;
import cn.maihe.framework.starter.base.sql.MapperInterface;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.FieldFill;
import com.baomidou.mybatisplus.enums.IdType;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@TableName("t_revoke_guarantee_data")
@NoArgsConstructor
@AllArgsConstructor
@Data
@Builder
@MapperInterface("cn.maihe.elg.operation.repository.mapper.RevokeGuaranteeDataMapper")
public class RevokeGuaranteeData extends BaseEntity {
    /**
     * 主键
     */
    @TableId(type = IdType.ID_WORKER)
    private Long id;

    /**
     * 保函撤销记录主键id
     */
    @TableField(value = "revoke_order_id")
    private Long revokeOrderId;

    /**
     * 保函编号
     */
    @TableField(value = "guarantee_no")
    private String guaranteeNo;

    /**
     * 保函序列号
     */
    @TableField(value = "serial_num")
    private String serialNum;

    /**
     * 被保证人名称
     */
    @TableField(value = "principal")
    private String principal;

    /**
     * 项目编码
     */
    @TableField(value = "project_code")
    private String projectCode;

    /**
     * 合同/工程/标段编码
     */
    @TableField(value = "section_code")
    private String sectionCode;

    /**
     * 请求处理方式 0已通知名单 1单次撤销名单 2罚没名单
     */
    @TableField(value = "process_style")
    private Integer processStyle;

    /**
     * 0未处理 1已处理 2处理异常
     */
    @TableField(value = "process_status")
    private Integer processStatus;

    /**
     * 创建时间
     */
    @TableField(value = "gmt_create", fill = FieldFill.INSERT)
    private Date gmtCreate;

    /**
     * 更新时间
     */
    @TableField(value = "gmt_modified", fill = FieldFill.INSERT_UPDATE)
    private Date gmtModified;

    /**
     * 创建用户
     */
    @TableField(value = "user_create", fill = FieldFill.INSERT)
    private String userCreate;

    /**
     * 更新用户
     */
    @TableField(value = "user_modified", fill = FieldFill.INSERT_UPDATE)
    private String userModified;

    /**
     * 备注说明
     */
    @TableField(value = "remark")
    private String remark;

    public RevokeGuaranteeDataVo buildVo() {
        return new RevokeGuaranteeDataVo(id, revokeOrderId, guaranteeNo, serialNum, principal, projectCode, sectionCode, processStyle, processStatus, gmtCreate, gmtModified, userCreate, userModified, remark);
    }

    public static RevokeGuaranteeData of(RevokeGuaranteeDataVo vo) {
        return new RevokeGuaranteeData(vo.getId(), vo.getRevokeOrderId(), vo.getGuaranteeNo(), vo.getSerialNum(), vo.getPrincipal(), vo.getProjectCode(), vo.getSectionCode(), vo.getProcessStyle(), vo.getProcessStatus(), vo.getGmtCreate(), vo.getGmtModified(), vo.getUserCreate(), vo.getUserModified(), vo.getRemark());
    }
}
